
grApp.controller('CalendarDemoCtrl', ['$scope', function ($scope) {
    'use strict';

    $scope.loadEvents = function () {
        $scope.eventSource = createRandomEvents();
    };

    //事件触发
    $scope.onEventSelected = function (event) {
        alert('显示事件')
        $scope.event = event;
    };

    function createRandomEvents() {
        var events = [];
        for (var i = 0; i < 20; i += 1) {
            var date = new Date();
            if(i%2 === 0){
                events.push({
                    title: 'Day - ' + i,
                    startTime: new Date(2015,10,i),
                    endTime: new Date(2015,10,i),
                    allDay: false
                });
            }else{
                events.push({
                    title: '恭喜 - ' + i,
                    startTime: new Date(2015,10,i),
                    endTime: new Date(2015,10,i),
                    allDay: true
                });
            }

        }
        return events;
    }
}]);